#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int n,k=0;
	int mum[100] = { 0 };
	scanf("%d", &n);
	for (int i = 0; i <= n - 1; i++)
	{
		scanf("%d", &mum[i]);
		k += mum[i];
	}
	int max = mum[0];
	for (int i = 1; i <= n - 1; i++)
		if (mum[i] > max)
			max = mum[i];
	printf("%d", k - max);
	return 0;
	
}